﻿using System;
using System.IO;

namespace negoserverjni
{
    public class PseudoStream : Stream
    {
        State s;
        public PseudoStream(State state)
        {
            s = state;
        }
        public override bool CanRead
        { get { return true; } }

        public override bool CanWrite
        { get { return true; } }

        public override bool CanSeek
        { get { return false; } }

        public override bool CanTimeout
        { get { return false; } }
  
        public override void Flush()
        {}

        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
        {
            return s.Read(buffer, offset, count, callback, state);
        }
        public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
        {
            return s.Write(buffer, offset, count, callback, state);
        }
        public override int Read(byte[] buffer, int offset, int count)
        {
            throw new NotImplementedException();
        }
        public override void Write(byte[] buffer, int offset, int count)
        {
            throw new NotImplementedException();
        }
        public override int EndRead(IAsyncResult asyncResult)
        {
            return s.LengthRead;
        }
        public override void EndWrite(IAsyncResult asyncResult)
        {
            //s.C
            return;
        }
        protected override void Dispose(bool disposing)
        {
            return;
        }
        //NotImplemented
        public override void SetLength(long value)
        {
            throw new NotImplementedException();
        }
        public override long Seek(long offset, SeekOrigin origin)
        {
            throw new NotImplementedException();
        }
        public override long Position
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }
        public override long Length
        {
            get { throw new NotImplementedException(); }
        }

    }
}
